package Enums;

public enum EquipType {
    GENERAL(0),
    PUMPS(1),
    HOSES(2),
    VALVES(3),
    SIGHT_GLASSES(4),
    CO2_HOSES(5),
    MISC(6);
    
    private int type;

    EquipType(final int type) {
        this.type = type;
    }

    public int getType() {
        return type;
    }
    
    public static EquipType getType(final String type) {
            return getType(Integer.parseInt(type));
    }
    
    public static EquipType getType(final int type) {
        switch (type) {
        case 0:
            return GENERAL;
        case 1:
            return PUMPS;
        case 2:
            return HOSES;
        case 3:
            return VALVES;
        case 4:
            return SIGHT_GLASSES;
        case 5:
            return CO2_HOSES;
        case 6:
            return MISC;
        default:
            throw new EnumConstantNotPresentException(DocType.class, String.valueOf(type));
        }
    }
    
    
    public static int getEquipTypeByName(final String str) {
        if(str.equals("GENERAL")){
            return 0;
        } else if(str.equals("PUMPS")){
            return 1;
        } else if(str.equals("HOSES")){
            return 2;
        } else if(str.equals("VALVES")){
            return 3;
        } else if(str.equals("SIGHT_GLASSES")){
            return 4;
        } else if(str.equals("CO2_HOSES")){
            return 5;
        } else if(str.equals("MISC")){
            return 6;
        } else {
            return 0;
        }
    }
    
    public static String getEquipTypeDescription(final int task) {
        switch (task) {
            case 0:
                return "General Equipment: ";
            case 1:
                return "Pumps: ";
            case 2:
                return "Beer Hoses: ";
            case 3:
                return "Valves: ";
            case 4:
                return "Sight Glasses: ";
            case 5:
                return "CO2 / Air Hoses: ";
            case 6:
                return "Misc. Small Parts: ";
            default:
                throw new EnumConstantNotPresentException(DocType.class, String.valueOf(task));
        }
    }
}
